package net.iiyasvn.utils;

import net.iiyasvn.download.PicDownloader;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;

public class GetPicUtils {
	private static Bitmap bitmap;
	private static String url;
	public static Bitmap getImageFromUrl(String string)
	{
		url = string;
		System.out.println("url--->" + url);
		new Thread(r).start();
		return bitmap;
	}
	
	static Handler handler = new Handler() {
		
		@Override
		public void handleMessage(Message msg) {
			bitmap = (Bitmap)msg.obj;
			super.handleMessage(msg);
		}
		    	
	};

	static Runnable r = new Runnable() {
		
		@Override
		public void run() {
			bitmap = PicDownloader.downloadBitmap(url);
			Message msg = handler.obtainMessage();
			msg.obj= bitmap;
			handler.sendMessage(msg);
		}
	};
}
